function buildTrimedUpperCaseKey(key: string) {
    return key?.toString()?.trim()?.toUpperCase();
}

function setEnvironmentValue(key: string, value: string | undefined | null) {

    const trimedUpperCaseKey = buildTrimedUpperCaseKey(key);

    if ((trimedUpperCaseKey?.length ?? -1) <= 0) {
        return;
    }

    process.env[trimedUpperCaseKey] = value;
}

function getEnvironmentValue(key: string): string {
    return process.env?.[buildTrimedUpperCaseKey(key)];
}

export { setEnvironmentValue, getEnvironmentValue };